package br.com.felix.easyclearcase.ui.dialogs;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JFrame;
import br.com.felix.easyclearcase.Comment;
import br.com.felix.easyclearcase.EasyClearCaseFile;

/**
 * Dialog used to ask the user's comment about a file being added to source control.
 * @see AbstractCommentDialog
 * */
public class AddToSourceControlDialog extends AbstractCommentDialog {
	
	private static final long serialVersionUID = 7710391949725310028L;

	/**
	 * @see AbstractCommentDialog#AbstractCommentDialog(JFrame, File, Comment)
	 * */
	public AddToSourceControlDialog(JFrame parent, EasyClearCaseFile file, final Comment commonComment) {
		super(parent, file, commonComment);
		chkApplyToAll.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e) {
				commonComment.setApplyToAll(chkApplyToAll.isSelected());
				if(chkApplyToAll.isSelected()){
					commonComment.setComment(txtaComment.getText());
				}	
			}
		});
	}

	
	
	/**
	 * @see AbstractCommentDialog#getOperationConfirmationTitle()
	 * */
	@Override
	protected String getOperationConfirmationTitle() {
		return "Add this file to Source Control?";
	}
}
